<?
    abstract class GridController extends RepositoryController
    {
        public function load($where = null)
        {
            $rep = $this->repo();

            $query = $rep
                ->query()
                ->take($_GET['start'])
                ->limit($_GET['limit'])
                ->where($where)
                ->asc($_GET['sort']);

            if(strtolower($_GET['dir']) == 'desc')
            {
                $query->desc($_GET['sort']);
            }

            $this->jsonp(array(
                'data' => $query->results(),
                'total' => $query->count()
            ));
        }
    }
?>